#ifndef FACTORY_H
#define FACTORY_H

#include <map>
#include <string>

template <class T>
class Factory
{
public:

	typedef T* (*Function)();
	
	T* Create(const std::string& typeName) 
	{
		Function f = m_Map[typeName];
		if(f)
		{
			return f();
		}
		return 0;
	}


	bool AddObject (const std::string& typeName, Function f)
	{
		m_Map[typeName] = f;
		return true;	
	}


private:

	typedef std::map<std::string, Function> FactoryMap;
	FactoryMap m_Map;

};

#endif